import time

from selenium import webdriver
from selenium.webdriver import Keys, ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.edge.service import Service

if __name__ == '__main__':
    exe_path = "../driver/msedgedriver.exe"
    service = Service(executable_path=exe_path)
    browser = webdriver.Edge(service=service)
    browser.maximize_window()
    browser.get(url="https://www.jd.com")

    # 设置隐式等待时间策略，用于查找元素或者命令的执行
    # 每个绘画都需要设置一次
    browser.implicitly_wait(time_to_wait=10)

    try:
        print("开始查找指定的元素")
        input = browser.find_element(by=By.ID, value="key111")
        print("查找到指定元素")
    except Exception:
        print("处理异常")
